﻿<UserControl
    x:Class="Wimm.CustomContols.Filter"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Wimm.CustomContols"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:c="using:Wimm.Common.Converters"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400">

     <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled" Margin="0 0 0 5">
       <StackPanel Orientation="Vertical" Margin="0 0 0 5">
            <StackPanel Orientation="Horizontal" Margin="0 0 0 20">
                <TextBlock VerticalAlignment="Center" Margin="0 0 20 0" Style="{StaticResource SubheaderTextBlockStyle}" x:Uid="Period"/>
                <ComboBox VerticalAlignment="Center" ItemsSource="{Binding Path=FilterData.TimePeriods,Mode=OneTime}" 
                          DisplayMemberPath="Name" SelectedItem="{Binding Path=FilterData.SelectedTimePeriod,Mode=TwoWay}"
                          Width="140"/>
                <TextBlock VerticalAlignment="Center" Margin="20 0 20 0" Style="{StaticResource SubheaderTextBlockStyle}" x:Uid="Categories"/>
                <ComboBox VerticalAlignment="Center" ItemsSource="{Binding Path=FilterData.Categories, Mode=OneTime}" 
                          SelectedItem="{Binding Path=FilterData.SelectedCategory, Mode=TwoWay}" 
                          Width="230">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Opacity="{Binding Opacity}" Text="{Binding Value}"/>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
                <CheckBox Margin="20 0 20 0" IsChecked="{Binding Path=FilterData.Detailed, Mode=TwoWay}" x:Uid="Detailed"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Margin="0 0 0 20">
                <TextBlock VerticalAlignment="Center" Margin="0 0 20 0" Style="{StaticResource SubheaderTextBlockStyle}" x:Uid="From"/>
                <DatePicker VerticalAlignment="Center" Date="{Binding Path=FilterData.FromFilter,Mode=TwoWay}" DayFormat="{}{day.integer} ({dayofweek.abbreviated})"></DatePicker>
                <TextBlock VerticalAlignment="Center" Margin="20 0 20 0" Style="{StaticResource SubheaderTextBlockStyle}" x:Uid="To"/>
                <DatePicker VerticalAlignment="Center" Date="{Binding Path=FilterData.ToFilter, Mode=TwoWay}" DayFormat="{}{day.integer} ({dayofweek.abbreviated})" ></DatePicker>
                <!-- apply key instead ApplyCommand.Execute(null)
                <AppBarButton VerticalAlignment="Center" Icon="Accept" IsCompact="True"
                          x:Name="Apply" Command="{Binding Path=FilterData.ApplyCommand}"></AppBarButton>-->
            </StackPanel>
        </StackPanel>
    </ScrollViewer>
</UserControl>
